package uy.com.tsi2G7.superbet.ui;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import uy.com.tsi2G7.superbet.account.AccountService;
import uy.com.tsi2G7.superbet.util.Utils;

public class ConfirmRegistrationServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	@EJB
	private AccountService accountService;
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		try{
			String mail = (String)req.getParameter("user");
			String accountId = Utils.desencriptar(mail);
			accountService.activateAccount(accountId);
			resp.getWriter().println("Hola");
		}catch(Exception e){
			
		}
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(req, resp);
	}
	
	
}
